BI.namespace('core');

BI.core.Scene = new Class({
    initialize : function (width, height) {
    	this.width = width;
    	this.height = height;
    	this.background = null;
    	this.layers = [];
    }, 
    setBackground: function(background){
    	if (!background){
    		throw new Error("Background cant be null");
    	}
    	
    	this.background = background;
    	// validate if background is not bigger than scene width
    	for (var i = 0; i < this.background.elements.length; i++){
    		if (this.background.elements[i].image.width > this.width
    			|| this.background.elements[i].image.height > this.height){
    			throw new Error("Background image can't be bigger than scene size");
    		}
    	}
    },
    addLayer: function(layer){
    	this.layers.push(layer);
    }    
});

BI.core.SceneLayer = new Class({
    initialize : function () {
    	this.sprites = [];
    },
    addSprite: function(sprite){
    	this.sprites.push(sprite);
    }
});